package com.mushuilingfeng.ddd.user.domain.user;

import com.mushuilingfeng.ddd.user.domain.user.dto.AbstractLoginDto;
import com.mushuilingfeng.ddd.user.domain.user.entity.User;

/**
 * 用户登陆拦截器
 *
 * @author
 * @date 2024/9/29
 */
public interface IUserLoginFilter extends Comparable<IUserLoginFilter> {
    
    default int order() {
        return 100;
    }
    
    void filter(User user, AbstractLoginDto loginParams);
    
    @Override
    default int compareTo(IUserLoginFilter o) {
        int o1 = this.order();
        int o2 = o.order();
        if (o1 < o2) {
            return -1;
        }
        if (o1 > o2) {
            return 1;
        }
        return 0;
    }
}
